<template>
  <div class="divider" ref="title" :id="props.id">
    <h3 v-if="level === '1'" @click="toggleShow()"><span></span>{{ props.name }}</h3>
    <h4 v-if="level === '2'">{{ props.name }}</h4>
    <h5 v-if="level === '3'">{{ props.name }}</h5>
  </div>
</template>
<script setup>
const emit = defineEmits();
const props = defineProps({
  name: String,
  id: String,
  own: String,
  level: String
})
let title = ref()
let curTitleInfo = reactive({
  id: props.id,
  name: props.name,
  own: props.own,
  level: props.level,
  titleHeight: 0,
})
const test = []
onMounted(async () => {
  getTitleHeight()
  test.push(props)
})

const getTitleHeight = () => {
  curTitleInfo.titleHeight = title.value.offsetTop
}
const toggleShow = () => {
  emit("toggleShow");
}
defineExpose({
  curTitleInfo,
  getTitleHeight
})
</script>
<style scoped lang="scss">
.divider {
  //margin: 10px 0 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;

  h4 {
    font-size: 16px;
    font-weight: bold;
    color: #107ce5;
  }

  h5 {
    font-size: 16px;
    font-weight: bold;
    color: #333333;
    text-align: center;
  }

  .el-divider--vertical {
    margin-right: 10px;
    border-width: 4px;
    border-color: #333;
    height: 20px;
  }

  span {
    font-weight: bold;
    font-size: 18px;
  }

  .secondary-title {
    font-weight: bold;
    font-size: 16px;
  }
}
</style>